﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DAL = AccessDAL;

public partial class Control_Link_Image : System.Web.UI.UserControl
{
    DAL.LinkTableAdapters.LinkTableAdapter DL =
        new DAL.LinkTableAdapters.LinkTableAdapter();

    MODEL.Link ML = new MODEL.Link();
    MODEL.Link _ML = new MODEL.Link();

    BLL.Link BL = new BLL.Link();

    #region 封装字段
    private string dataListStyle;

    public string DataListStyle
    {
        get { return dataListStyle; }
        set { dataListStyle = value; }
    }
    #endregion

    protected void Page_Load(object sender, EventArgs e)
    {
        ControlDataInit();

        DLStyleInit();
    }


    #region ControlDataInit
    protected void ControlDataInit()
    {
        try
        {
            DataTable DT_ImgLink = DL.GetImgLinkByState(true);

            DL_ImgLink.DataSource = DT_ImgLink.DefaultView;

            DL_ImgLink.DataBind();
        }
        catch (Exception ex)
        {
            LB_ImgLink.Text = ex.Message;
        }
    }
    #endregion


    #region DLStyleInit
    protected void DLStyleInit()
    {
        try
        {
            switch (this.DataListStyle)
            {
                case "Horizontal":
                    DL_ImgLink.RepeatDirection = RepeatDirection.Horizontal;
                    break;
                case "Vertical":
                    DL_ImgLink.RepeatDirection = RepeatDirection.Vertical;
                    break;
            }
        }
        catch (Exception ex)
        {
            LB_ImgLink.Text = ex.Message;
        }
    }
    #endregion
}
